package com.api.user.service.impl;

import com.api.user.dao.FqaMapper;
import com.api.user.model.Fqa;
import com.api.user.service.FqaService;
import com.api.core.service.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import com.api.common.JSONUtils;
import com.api.core.response.Result;
import com.api.core.response.ResultGenerator;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

/**
 * Created by wanghuiwen on 2021/04/20.
 */
@Service
@Transactional
public class FqaServiceImpl extends AbstractService<Fqa> implements FqaService {
    @Resource
    private FqaMapper fqaMapper;

    @Override
    public Result list(Integer type){

        List<Fqa> res = fqaMapper.list(type);
        return ResultGenerator.genSuccessResult(res);
    }

    @Override
    public Result add(Fqa fqa) {
        if(null!=fqa.getId()){
            this.update(fqa);
        }else{
            this.save(fqa);
        }
        return ResultGenerator.genSuccessResult();
    }
}
